<?php $this->load->view('config/header_home');?>
<h2>Blangko - <?php echo strftime("%B %Y",strtotime(date('d-m-Y')))?></h2>
<div class="line-separtor"></div>
<br/>
	<a href="<?php echo site_url()?>blangko/add" class="btn btn-primary"> Blangko baru </a>
    <div class="input-append" id="search">
    <form method="post" class="form-horizontal" action="<?php echo site_url() ?>blangko/searchData" >
        <input class="span4" id="appendedInputButtons" type="text" name="name">
        <input type="submit" name="submit" value="Search" class="btn" />
        <input type="button" name="submit" value="Options" class="btn" role="button" data-target="#myModalSearch" data-toggle="modal"/>
        <div id="myModalSearch" class="modal fade hide" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
                <h4 id="myModalLabel">Pilihan pencarian</h4>
            </div>
            <div class="modal-body" >
                <div class="control-group">
                    <label class="control-label" for="bulan">Bulan</label>
                    <div class="controls">
                        <select name="bulan">
                        	<option value="0" >--</option>
                            <option value="01" >Januari</option>
                            <option value="02" >Febuari</option>
                            <option value="03" >Maret</option>
                            <option value="04" >April</option>
                            <option value="05" >Mei</option>
                            <option value="06" >Juni</option>
                            <option value="07" >Juli</option>
                            <option value="08" >Agustus</option>
                            <option value="09" >September</option>
                            <option value="10" >Oktober</option>
                            <option value="11" >November</option>
                            <option value="12" >Desember</option>
                        </select>
                    </div>
                </div>
                 <div class="control-group">
                    <label class="control-label" for="tahun">Tahun</label>
                    <div class="controls">
                        <select name="tahun">
                        	<option value="0">--</option>
                            <?php
                                $years = range (2007, date('Y'));
                                foreach ($years as $value):
                            ?>
                                <option value="<?php echo $value ?>" ><?php echo $value ?></option>
                            <?php endforeach;?>
                        </select>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn" data-dismiss="modal" aria-hidden="true">Tutup</button>
            </div>
        </div>
    </form>
    </div>
<br/>
<br/>
<br/>	
	<?php $success = $this->session->flashdata('success');?>
	<?php if ($success):?>
		<div class="alert alert-success">
			Data telah tersimpan
		</div>
	<?php endif?>
	
	<?php $error = $this->session->flashdata('error');?>
	<?php if ($error):?>
		<div class="alert alert-error">
			Data gagal tersimpan
		</div>
	<?php endif?>
	
	<?php $delete = $this->session->flashdata('delete');?>
	<?php if ($delete):?>
		<div class="alert alert-success">
			Data telah terhapus
		</div>
	<?php endif?>
<br/>
<table class="table table-condensed table-hover">
	<thead>
		<th>#</th>
        <th>Cetak</th>
		<th>No. Agenda</th>
		<th>Nama</th>
		<th>Tgl. Terbit</th>
		<th>Aksi</th>
	</thead>
	<tbody>
	<?php if (@$results):?>
		<?php $i=1;?>
		<?php foreach ($results as $row):?>
		<tr>
			<td><?php echo $i;?></td>
            <td><a href="javascript: void(0)" onclick="window.open('<?php echo site_url()?>blangko/printData/<?php echo $row['id_pengaju']?>', 'windowname1', 'width=800, height=700,location=1,status=1,scrollbars=1'); return false;" class="icon-print"></td>
			<td><?php echo $row['no_agenda']?></td>
			<td><?php echo $row['nama_pengaju']?></td>
			<td><?php echo date('d-m-Y', strtotime($row['tgl_terbit_police']))?></td>
			<td>
				<a href="<?php echo site_url()?>blangko/edit/<?php echo $row['id_pengaju']?>" class="icon-edit"></a>&nbsp;
				<a href="<?php echo site_url()?>blangko/delete/<?php echo $row['id_pengaju']?>" class="icon-trash" onclick="return confirm('Anda yakin akan menghapus data ini?');"></a>
			</td>
		</tr>
		<?php $i++;?>
		<?php endforeach?>
	<?php else:?>
		<tr>
			<td colspan="6">
				<br/>
				<div class="alert alert-error" style="text-align:center">
					Tidak ada record
				</div>
			</td>
		</tr>
	<?php endif?>
	</tbody>
</table>
<?php $this->load->view('config/footer_home');?>